<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <!-- Swiper CDN -->
    <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.css">
    <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
    <script src="https://unpkg.com/swiper/swiper-bundle.js"> </script>
    <script src="https://unpkg.com/swiper/swiper-bundle.min.js"> </script>
    <script src="https://unpkg.com/swiper/swiper-bundle.min.js.map"> </script>
    <style>
      html,
      body {
        position: relative;
        height: 100%;
      }

      body {
        background: #eee;
        font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        font-size: 14px;
        color: #000;
        margin: 0;
        padding: 0;
      }

      .swiper {
        width: 100%;
        height: 100%;
      }

      .swiper-slide {
        text-align: center;
        font-size: 18px;
        background: #fff;

        /* Center slide text vertically */
        display: -webkit-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        -webkit-align-items: center;
        align-items: center;
      }

      .swiper-slide img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    </style>
</head>

<body>
    <!-- Swiper -->
    <div class="swiper-container">
        <div class="swiper-wrapper">
            
            <!-- <div class="swiper-slide">Slide 1</div> -->
        </div>
        <!-- Add Pagination -->
        <div class="swiper-pagination"></div>
    </div>
</body>
<script>
    new Promise(function (resolve, reject) {
        $.ajax({
            method: 'GET',
            url: 'https://www.zzgoodqc.cn/index.php/index/index/getImgList',
            success: function (str) {
                var data = str.data;
                resolve(data)
            },
            error: function (err) {
                console.log(err);
            }
        })
    }).then(function(data){
        var imgList = '';
        for(let a =0;a<data.length-2;a++){
            imgList+=`<div class="swiper-slide"><img src="${data[a]}" alt=""></div>`
            console.log(data[a]);
        }
        setTimeout(function(){
            document.getElementsByClassName('swiper-wrapper')[0].innerHTML = imgList
        },2000);
        
    })





    var swiper = new Swiper('.swiper-container', {
        slidesPerView: 3,
        spaceBetween: 30,
        centeredSlides: true,
        loop: true,
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
    });
</script>

</html>